package springboot.test15.sevice.impl;

import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import springboot.test15.bean.User;
import springboot.test15.mapper.UserMapper;
import springboot.test15.sevice.AccountService;

@Service
class AccountServiceImpl implements AccountService {
    @Autowired
    UserMapper userMapper;

    Counter counter;

    public AccountServiceImpl(MeterRegistry meterRegistry){
        counter = meterRegistry.counter("AccountService.getByName.count");
    }
    public User getByName(String username){
        counter.increment();
        return userMapper.selectByUsername(username);
    }
}
